package com.ruoyi.app.mapper;

import com.ruoyi.app.domain.User;
import com.ruoyi.app.domain.UserExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;
import java.util.List;

public interface UserMapper {
    int countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(Long id);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    User selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    @Update("UPDATE `user` SET balance += #{amount} WHERE id = #{id}")
    int addBalance(Long id, BigDecimal amount);

    List<User> selectAllList();

    List<User> selectByInvitationCode(String code);
}